Skip to content

[POC] Add CLI for PHP Debugger with DBGp protocol support, including breakpoint handling, variable inspection, and stack tracing#12

Open
Haehnchen wants to merge 1 commit intopronskiy:mainfrom
Haehnchen:feature/cli-agent
Open

[POC] Add CLI for PHP Debugger with DBGp protocol support, including breakpoint handling, variable inspection, and stack tracing#12
Haehnchen wants to merge 1 commit intopronskiy:mainfrom
Haehnchen:feature/cli-agent

Conversation

@Haehnchen
Copy link

Just an idea: Provide a simple cli so agent can call and debug also.


[...]

● Bash(/home/daniel/playground/php-debugger/cli/bin/dbg -breakpoint src/Controller/HomeController.php:33,34,36 -timeout 15s)
  ⎿  Running in the background (↓ to manage)

● Bash(sleep 1 && curl -s "http://127.0.0.1:8000/?XDEBUG_SESSION=1" > /dev/null &
      sleep 3)
  ⎿  (No output)

● Task Output(non-blocking) bj7spjisf
  ⎿  Error: No task found with ID: bj7spjisf

● Read 1 file (ctrl+o to expand)    
                                                               
● The debugger successfully connected and hit all 3 breakpoints. Here's what the HomeController variables look like:
           
  Variables at Line 36 (before render)
                                                                                                                                                                                                                                                 
  Template Variables (passed to Twig):
                                                                                                                                                                                                                                                 
  ┌──────────────────┬───────────┬─────────────────────────────────────────────────────────────────────────────────────────────────┐
  │     Variable     │   Type    │                                              Value                                              │
  ├──────────────────┼───────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ latestFeatures   │ array[14] │ 14 items, each with 3 fields (features from SymfonyFeatureCollector)                            │
  ├──────────────────┼───────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ pluginUpdateInfo │ array[6]  │ 6 plugins with update info: symfony, shopware, php-annotations, laravel, phpunit, vuejs-toolbox │
  └──────────────────┴───────────┴─────────────────────────────────────────────────────────────────────────────────────────────────┘

  Injected Services:

  ┌──────────────────────┬──────────────────────────────────────────┐
  │       Variable       │                  Class                   │
  ├──────────────────────┼──────────────────────────────────────────┤
  │ $request             │ Symfony\Component\HttpFoundation\Request │
  ├──────────────────────┼──────────────────────────────────────────┤
  │ $pluginRepository    │ App\Repository\PluginRepository          │
  ├──────────────────────┼──────────────────────────────────────────┤
  │ $featureCollector    │ App\Service\SymfonyFeatureCollector      │
  ├──────────────────────┼──────────────────────────────────────────┤
  │ $pluginUpdateService │ App\Service\PluginUpdateService          │
  └──────────────────────┴──────────────────────────────────────────┘

  Request Details:

  - pathInfo: /
  - requestUri: /?XDEBUG_SESSION=1
  - method: GET

  Other locals:

  - $p = null (query parameter not set)
  - $github = uninitialized
  - $plugin = uninitialized

✻ Baked for 1m 25s

● Background command "Start debugger in background" completed (exit code 0)

● The debugger task completed successfully. The full output was already shown above - the HomeController has two main template variables (latestFeatures and pluginUpdateInfo) that get passed to frontpage.html.twig.

…oint handling, variable inspection, and stack tracing
@pronskiy
Copy link
Owner

Thanks! I like the idea. Let me try it out and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants